package com.homework.test2;

import java.util.Random;
import java.util.Scanner;

public class Demo9 {
    public static void main(String[] args) {
        Random random = new Random();
        int[] arr = new int[5];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = random.nextInt(99 - 1 + 1) + 1;
        }
        System.out.println("随机生成的数组中元素为：");
        for (int i : arr) {
            System.out.print(i+" ");
        }
        System.out.println();

        System.out.print("输入2-5之间的一个数字:");
        Scanner input = new Scanner(System.in);
        int num = input.nextInt();

        System.out.println("符合条件的元素为：");
        for (int i : arr) {
            if (i%num==0){
                System.out.print(i+" ");
            }
        }

    }
}
